<?
$this->placeholder('page_title')->set('Game: Sessions');
$grid_options = array('width' => 800);

$filename = dirname(__FILE__) . '/sessionsitems_grid.ini';
$col = new Zend_Config_Ini($filename, 'columns');

$this->headScript()->captureStart();
?>

function session_grid_game_type_formatter(gt)
{
    return '<a href="<?= $this->baseUrl() ?>/admin/game/gametypeviewitem/id/' + gt + '">Game Type</a>';
}

function session_grid_title_get(id, record)
{
    if ((!record)) return '';
    return '<a href="<?= $this->baseUrl() ?>/admin/game/gametypesviewitem/id/' + record.game_type + '">' + record.game + '</a>';

}

function session_grid_view_formatter(p)
{
    return '<a href="<?= $this->baseUrl() ?>/admin/game/sessionsviewitem/id/'
        + p + '"><img src="<?= $this->baseUrl() ?>/images/icons/view.gif" height="20" width="20" border="0"/></a>';
}

function session_grid_edit_formatter(p)
{
    return '<a href="<?= $this->baseUrl() ?>/admin/game/sessionsedititem/id/'
        + p + '"><img src="<?= $this->baseUrl() ?>/images/icons/edit.gif" height="20" width="20" border="0"/></a>';
}

var ugd_months = [
  ,
  'Jan',
  'Feb',
  'Mar',
  'Apr',
  'May',
  'Jun',
  'Jul',
  'Aug',
  'Sep',
  'Oct',
  'Nov',
  'Dec'
];

function unity_year(y)
{
    return new String(y).replace(/^20/, '');
}

function grid_date_formatter(pDate)
{
    hits = new String(pDate).match(/([\d]{4})-([\d]{2})-([\d]{2})/)
    if (hits)
    {
	var out = ugd_months[new Number(hits[2]).valueOf()] + '&nbsp;' + new Number(hits[3]).valueOf() + '&nbsp;' + unity_year(hits[1]);

	return out;
    }
    else
    {
	return pDate;
    }
}

function session_grid_delete_formatter(id)
{
    return '<a href="/admin/game/sessionsdeleteitem/id/' + id + '"><img src="/images/icons/x.gif" border="0" width="20" height="20"></a>';
}
<?  $this->headScript()->captureEnd();   ?>

<?= $this->dojostore('sessions_store', $this->baseUrl() . '/game/admin/sessionsstore') ?>
<?= $this->dojogrid('sessions_grid', 'sessions_store', $col, 'id', NULL, $grid_options) ?>

<?= $this->zupallinkbutton('/admin/game/sessionsnewitem', 'Add Session') ?>